package actions
{
	import core.actor.core.ActorView;
	import core.actor.core.Bones;
	import core.actor.core.Magics;
	import core.actor.core.Texts;
	
	import flash.events.EventDispatcher;

	public class BaseAction extends EventDispatcher implements ITickable
	{
		public static const ACTION_COMPLETE:String = "ACTOR_ACTION_COMPLETE";
		
		protected var _actor:ActorView;
		protected var _tickType:int = 1;//重写
		
		public function BaseAction()
		{
		}
		
		public function update(step:int):void//重写
		{
			_actor.update(step);
		}
		
		public function get tickType():int
		{
			return _tickType;
		}
		
		public function init(actor:ActorView):void
		{
			_actor = actor;
			setAni(_actor.actorType);
		}
		
		protected function setAni(charType:String):void
		{
			//TODO:读动画
			//TODO:完成后初始化动画
		}
		
		public function play():void//重写
		{
			TickManager.instance.addObject(this);
		}
		
		public function pause():void
		{
			TickManager.instance.removeObject(this);
		}
		
		public function stop():void
		{
			TickManager.instance.removeObject(this);
			_actor.reset();
		}//stop & reset
		
		public function dispose():void
		{
			stop();
			_actor = null;
		}
	}
}